import json

import requests

if __name__ == '__main__':
    #python
    r = requests.get("http://CDH-master:8983/solr/hbaseSolr/select?q=id:*&wt=python")
    print(r.url)
    response = eval(r.text)
    print(response['response']['numFound'])
    for document in response['response']['docs']:
        print("  ID =", document['id'])
        print("  Name =", document['name'])
        print("  City =", document['city'])
        print("  Salary =", document['salary'])
        print("-------------------------------")
    #json
    r = requests.get("http://CDH-slave1:8983/solr/hbaseSolr/select?q=id:*&wt=json")
    print(r.url)
    response = json.loads(r.text)
    print(response)